﻿using MongoDB.Bson;
using MongoDB.Driver.Builders;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Gavin.MongoTest
{
    class Program
    {
        static void Main(string[] args)
        {
            var list = new List<Person> {
                new Person{Name = "ccccccccc"},
                new Person{Name="dddddddddd"}
            };
            //4f6acafc-4c5d-45dc-956a-7a0c59864d7b
            var page = new Gavin.Common.dbhelper.PagerInfo { PageIndex = 1, PageSize = 2 };
            var result = Gavin.Common.dbhelper.MongoDBHelper.GetAll<Person>("Person", Query.EQ("_id", new Guid("4f6acafc-4c5d-45dc-956a-7a0c59864d7b")), page);

            foreach (var item in result)
            {
                Console.WriteLine("Id:{0} Name:{1}", item.Id, item.Name);
            }

            //Console.WriteLine(result);
            Console.ReadKey();
        }
    }
}
